home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / util / boot / appvm.lha / AppVM / vmread.s < prev   
Text File  |  1994-01-28  |  868b  |  53 lines

  1.  
  2.         include    std
  3.         include    exec/vmemory.i
  4.  
  5. BUFSIZE        equ    7495680
  6.  
  7. START:        move.l    4.w,a6
  8.         lea    dosname,a1
  9.         moveq    #0,d0
  10.         EXEC    OpenLibrary        ;get DOS
  11.         move.l    d0,DOS_LIB_PTR
  12.  
  13.         move.l    #BUFSIZE,d0
  14.         move.l    #MEMF_VM,d1
  15.         EXEC    AllocMem        ;get buffer
  16.         move.l    d0,a4
  17.  
  18.         move.l    DOS_LIB_PTR,a6
  19.  
  20.         move.l    #fname,d1
  21.         move.l    #MODE_OLDFILE,d2    ;open file to checksum
  22.         DOS    Open
  23.         move.l    d0,fhandle
  24.  
  25.         move.l    fhandle,d1
  26.         move.l    a4,d2
  27.         move.l    #BUFSIZE,d3        ;read whole file into VM
  28.         DOS    Read
  29.  
  30.         moveq    #0,d0            ;clear accum.
  31.         move.l    #BUFSIZE/4,d1
  32.         move.l    a4,a0
  33. ;---------------
  34. accum_longs    add.l    (a0)+,d0        ;add 'em up
  35.         subq.l    #1,d1
  36.         bne    accum_longs
  37. ;---------------
  38.         move.l    fhandle,d1        ;close file
  39.         DOS    Close
  40.  
  41.         move.l    4.w,a6
  42.         move.l    #BUFSIZE,d0
  43.         move.l    a4,a1
  44.         EXEC    FreeMem            ;release buffer
  45.         rts
  46.  
  47. DOS_LIB_PTR    ds.l    1
  48. fhandle        ds.l    1
  49.  
  50. dosname        DOSNAME
  51.  
  52. fname        dc.b    "dh0:HUGE",0
  53.